<?php
$desks = DeskService::search();
if ($desks)
{
	foreach ($desks as $desk)
	{
?>
<div style="width:30%; float:left;">
	<table border="1">
		<tr>
			<td>
				<?php if (0 < $desk['seats'][0]['player_id']) { ?>
				<a href="<?php echo Url::generate('player', 'ViewDetail', array('player_id' => $desk['seats'][0]['player_id'])) ?>"><?php echo $desk['seats'][0]['nickname'] ?></a>
				<?php } else {?>
				<a href="<?php echo Url::generate('seat', 'ChooseSeat', array('seat_id' => $desk['seats'][0]['id'])) ?>">坐这里</a>
				<?php } ?>
			</td>
			<td>
				<?php if (0 < $desk['seats'][1]['player_id']) { ?>
				<a href="<?php echo Url::generate('player', 'ViewDetail', array('player_id' => $desk['seats'][1]['player_id'])) ?>"><?php echo $desk['seats'][1]['nickname'] ?></a>
				<?php } else {?>
				<a href="<?php echo Url::generate('seat', 'ChooseSeat', array('seat_id' => $desk['seats'][1]['id'])) ?>">坐这里</a>
				<?php } ?>
			</td>
			<td>
				<?php if (0 < $desk['seats'][2]['player_id']) { ?>
				<a href="<?php echo Url::generate('player', 'ViewDetail', array('player_id' => $desk['seats'][2]['player_id'])) ?>"><?php echo $desk['seats'][2]['nickname'] ?></a>
				<?php } else {?>
				<a href="<?php echo Url::generate('seat', 'ChooseSeat', array('seat_id' => $desk['seats'][2]['id'])) ?>">坐这里</a>
				<?php } ?>
			</td>
		</tr>
		<tr>
			<td>
				<?php if (0 < $desk['seats'][7]['player_id']) { ?>
				<a href="<?php echo Url::generate('player', 'ViewDetail', array('player_id' => $desk['seats'][7]['player_id'])) ?>"><?php echo $desk['seats'][7]['nickname'] ?></a>
				<?php } else {?>
				<a href="<?php echo Url::generate('seat', 'ChooseSeat', array('seat_id' => $desk['seats'][7]['id'])) ?>">坐这里</a>
				<?php } ?>
			</td>
			<td><?php echo $desk['title'] ?></td>
			<td>
				<?php if (0 < $desk['seats'][3]['player_id']) { ?>
				<a href="<?php echo Url::generate('player', 'ViewDetail', array('player_id' => $desk['seats'][3]['player_id'])) ?>"><?php echo $desk['seats'][3]['nickname'] ?></a>
				<?php } else {?>
				<a href="<?php echo Url::generate('seat', 'ChooseSeat', array('seat_id' => $desk['seats'][3]['id'])) ?>">坐这里</a>
				<?php } ?>
			</td>
		</tr>
		<tr>
			<td>
				<?php if (0 < $desk['seats'][6]['player_id']) { ?>
				<a href="<?php echo Url::generate('player', 'ViewDetail', array('player_id' => $desk['seats'][6]['player_id'])) ?>"><?php echo $desk['seats'][6]['nickname'] ?></a>
				<?php } else {?>
				<a href="<?php echo Url::generate('seat', 'ChooseSeat', array('seat_id' => $desk['seats'][6]['id'])) ?>">坐这里</a>
				<?php } ?>
			</td>
			<td>
				<?php if (0 < $desk['seats'][5]['player_id']) { ?>
				<a href="<?php echo Url::generate('player', 'ViewDetail', array('player_id' => $desk['seats'][5]['player_id'])) ?>"><?php echo $desk['seats'][5]['nickname'] ?></a>
				<?php } else {?>
				<a href="<?php echo Url::generate('seat', 'ChooseSeat', array('seat_id' => $desk['seats'][5]['id'])) ?>">坐这里</a>
				<?php } ?>
			</td>
			<td>
				<?php if (0 < $desk['seats'][4]['player_id']) { ?>
				<a href="<?php echo Url::generate('player', 'ViewDetail', array('player_id' => $desk['seats'][4]['player_id'])) ?>"><?php echo $desk['seats'][4]['nickname'] ?></a>
				<?php } else {?>
				<a href="<?php echo Url::generate('seat', 'ChooseSeat', array('seat_id' => $desk['seats'][4]['id'])) ?>">坐这里</a>
				<?php } ?>
			</td>
		</tr>
	</table>
</div>
<?php
	}
}
?>